package com.zhengx.moduletest;


import android.app.Application;
import android.content.res.Configuration;

import com.zhengx.baselib.IApplication;
import com.zhengx.comm.utils.log.Logs;
import com.zhengx.moduletest.di.AppComponent;
import com.zhengx.moduletest.di.DaggerAppComponent;

/**
 * name：ModuleApplicationoFake
 * class: 类似Application
 * author: zhengx
 * create_time: 2019/1/18
 */

public class ModuleApplicationFake implements IApplication {

    private Application application;

    private static AppComponent appComponent;

    @Override
    public void onCreate(Application application) {
        this.application = application;
        if (appComponent == null) {
            appComponent = DaggerAppComponent
                    .builder()
                    .context(application)
                    .build();
        }
        Logs.config(true, true, false, Logs.LogDetailLevel.DETAILEDNESS);
        System.err.println("子模块 onCreate");
    }

    @Override
    public void onTerminate(Application application) {
        System.err.println("子模块 onTerminate");

    }

    @Override
    public void onConfigurationChanged(Application application, Configuration newConfig) {
        System.err.println("子模块 onConfiChanged");

    }

    @Override
    public void onLowMemory(Application application) {
        System.err.println("子模块 onLowMemory");

    }

    @Override
    public void onTrimMemory(Application application, int level) {
        System.err.println("子模块 onTrimMemory");

    }

    public Application getApplication() {
        return application;
    }

    public static AppComponent getAppComponent() {
        return appComponent;
    }
}
